using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter09
{
	/// <summary>
	/// Example03: Teeing Off
	/// A golf ball of mass 50 g is struck with a club (Fig.9.5). 
	/// The  force exerted by the club on the ball varies from 
	/// zero, at the instant before contact, up to same maximum 
	/// value and then back to zero when the ball leaves the club. 
	/// Thus, the force-time curve is qualitatively described by 
	/// Figure 9.4. Assuming that the ball travels 200 m, 
	/// estimate the magnitude of the impulse caused by the collision.
	/// impulse I = 2.2 kg.m/s
	/// </summary>
	public class Example03
	{
		public Example03()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			// 0 = v_y - g*t => t = v_y/g
			// l = v_x*2t = v^2 sin(2\theta) / g
			// v = \sqrt(gl)
			L.Length l = new L.Length();
			l.m = 200.0;
			L.Velocity v = new L.Velocity();
			v.X = Math.Sqrt(L.Constant.AccelerationOfGravity*l.m);
			L.Mass m = new L.Mass();
			m.kg = 50.0*0.001;
			L.Momentum pf = new L.Momentum(m,v);
			L.Momentum pi = new L.Momentum();
			L.Impulse I = new L.Impulse(pi,pf);
			result += Convert.ToString(I.kgmPERs);
		}
	}
}
